/*************************************************************************
    > File Name: book.cpp
    > Author: skylon
    > Site: blog.csdn.net/tcm_zhangpeng  
    > Created Time: 2016年05月14日 星期六 21时14分12秒
 ************************************************************************/

#include"buyer.h"

buyer::buyer()	//	constructor of basic class
{
	name = "";
	buyerID = 0;
	address = "";
	pay = 0;
}

buyer::buyer(string n, int b, string a, double p)	//	constructor of basic class
{
	name = n;
	buyerID = b;
	address = a;
	pay = p;
}

double buyer::getpay()	//	get pay
{
	return pay;
}

string buyer::getaddress()	//	get address of buyer
{
	return address;
}

string buyer::getbuyname()	//	get name of buyer
{
	return name;
}

int buyer::getid()	//	get ID of buyer
{
	return buyerID;
}

void member::display()	// display information of VIP
{
	cout << "name of people buy books: " << name << "\t";
	cout << "ID of people buy books: " << buyerID << "\t";
	cout << "Lv of people buy books: " << leaguer_grade << "\n";
	cout << "address of people buy books: " << address << "\n\n";
}

void member::setpay(double p)	// calc money of VIP
{
	if (leaguer_grade == 1)
	{
		pay = .95 * p + pay;
	}
	else if (leaguer_grade == 2)
	{
		pay = .90 * p + pay;
	}
	else if (leaguer_grade == 3)
	{
		pay = .85 * p + pay;
	}
	else if (leaguer_grade == 4)
	{
		pay = .8 * p + pay;
	}
	else if (leaguer_grade == 5)
	{
		pay = .7 * p + pay;
	}
	else
		cout << "wrong Lv!" << endl;
}

void honoured_guest::display()	//	display information of honoured guest
{		

	cout << "name of people buy books: " << name << "\t";
	cout << "ID of people buy books: " << buyerID << "\t";
	cout << "Guest is honoured! The discount is : " << discount_rate * 100 << "\n";
	cout << "address of people buy books: " << address << "\n\n";
}

void honoured_guest::setpay(double p)	//	calc money of honoured guest
{
	pay = pay + (1 - discount_rate) * p;
}

void layfolk::display()	// display information of ordinary people
{

	cout << "name of people buy books: " << name << "\t";
	cout << "ID of people buy books: " << buyerID << "\t";
	cout << "People buy book is ordinary." << "\n";
	cout << "address of people buy books: " << address << "\n\n";
}
void layfolk::setpay(double p)	//	calc money of ordinary people
{
	pay = pay + p;
}


